import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '房产编号',
    align: "center",
    dataIndex: 'propertyNumber'
  },
  {
    title: '业主名称',
    align: "center",
    dataIndex: 'ownerName'
  },
  {
    title: '金额',
    align: "center",
    dataIndex: 'money'
  },
  {
    title: '支付方式',
    align: "center",
    dataIndex: 'paymentMethod',
    customRender:({text}) => {
       return render.renderCategoryTree(text,'C03');
   },
  },
  {
    title: '日期',
    align: "center",
    dataIndex: 'paymentTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'mark'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "社区名称",
    field: 'communityName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "房产编号",
    field: 'propertyNumber',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "支付方式",
    field: 'paymentMethod',
    component: 'JCategorySelect',
    componentProps:{
      pcode: "C03",//back和事件未添加，暂时有问题
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '社区名称',
    field: 'communityName',
    component: 'Input',
  },
  {
    label: '房产编号',
    field: 'propertyNumber',
    component: 'Input',
  },
  {
    label: '业主名称',
    field: 'ownerName',
    component: 'Input',
  },
  {
    label: '金额',
    field: 'money',
    component: 'InputNumber',
  },
  {
    label: '支付方式',
    field: 'paymentMethod',
    component: 'JCategorySelect',
    componentProps:{
      pcode: "C03", //TODO back和事件未添加，暂时有问题
    },
  },
  {
    label: '日期',
    field: 'paymentTime',
    component: 'DatePicker',
  },
  {
    label: '备注',
    field: 'mark',
    component: 'Input',
  },
  {
    label: '类型',
    field: 'type',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  propertyNumber: {title: '房产编号',order: 1,view: 'text', type: 'string',},
  ownerName: {title: '业主名称',order: 2,view: 'text', type: 'string',},
  money: {title: '金额',order: 3,view: 'number', type: 'number',},
  paymentMethod: {title: '支付方式',order: 4,view: 'cat_tree', type: 'string',pcode: 'C03',},
  paymentTime: {title: '日期',order: 5,view: 'date', type: 'string',},
  mark: {title: '备注',order: 6,view: 'text', type: 'string',},
};
